home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / languages / debuglib_r2.lha / DebugLib.mod < prev    next >
Text File  |  1994-09-17  |  4KB  |  154 lines

  1. (*------------------------------------------
  2.  
  3.   :Module.      DebugLib.mod
  4.   :Author.      Albert Weinert  [awn]
  5.   :Address.     Adamsstr. 83; 51063 Köln; Germany
  6.   :EMail.       a.weinert@darkness.gun.de
  7.   :Phone.       +49-221-613100
  8.   :Revision.    R.2
  9.   :Date.        17-Sep-1994
  10.   :Copyright.   Albert Weinert
  11.   :Language.    Oberon-2
  12.   :Translator.  AmigaOberon V3.20
  13.   :Contents.    Interface to "debug.lib"
  14.   :Imports.     SmallLib.mod (dummy by [awn])
  15.   :Bugs.        when you use DebugLib.mod and RVI.mod together it may
  16.   :Bugs.        be possible that the linker warns you about double symbols.
  17.   :Bugs.        If this happens the remove the $JOIN rexxvars.o from RVI.mod and
  18.   :Bugs.        add an import for SmallLib.mod in RVI.mod.
  19.   :Remarks.     Needs interfaces 40.15 and "debug.lib"
  20.   :History.     .1     [awn] 03-Jul-1994 : Erstellt
  21.   :History.     .2     [awn] 17-Sep-1994 : Die Möglichkeit geschaffen über eine
  22.   :History.            ENV-Variable die Ausgabe der Debuginformationen Ein- und
  23.   :History.            Auszuschalten.
  24.  
  25. --------------------------------------------*)
  26. MODULE DebugLib;
  27.  
  28. IMPORT  Dos, Exec, SmallLib, SYSTEM, OberonLib;
  29.  
  30. (* $JOIN debug.lib *)
  31.  
  32. VAR debug : BOOLEAN;
  33.  
  34. PROCEDURE KCmpStr{"KCmpStr"}( string1{8}, string2{9}: Exec.LSTRPTR );
  35. PROCEDURE KGetChar{"KGetChar"}():CHAR;
  36. PROCEDURE KGetNum{"KGetNum"}():LONGINT;
  37. PROCEDURE KMayGetChar{"KMayGetChar"}():CHAR;
  38. PROCEDURE KPrintF{"KPrintF"}(string{8}: Exec.LSTRPTR; values{9} : SYSTEM.ADDRESS );
  39. PROCEDURE KPutChar{"KPutChar"}(char{0}: CHAR );
  40. PROCEDURE KPutStr{"KPutString"}(string{8}: Exec.LSTRPTR);
  41.  
  42. PROCEDURE CmpStrA*( string1{8}, string2{9}: Exec.LSTRPTR );
  43.   BEGIN
  44.     (* $IF SmallData *)
  45.     OberonLib.SetA5();
  46.     (* $END *)
  47.     IF debug THEN
  48.       KCmpStr( string1, string2 );
  49.     END;
  50.   END CmpStrA;
  51.  
  52. PROCEDURE GetCharA*():CHAR;
  53.   BEGIN
  54.     (* $IF SmallData *)
  55.     OberonLib.SetA5();
  56.     (* $END *)
  57.     IF debug THEN
  58.       RETURN KGetChar();
  59.     END;
  60.     RETURN 0X;
  61.   END GetCharA;
  62.  
  63. PROCEDURE GetNumA*():LONGINT;
  64.   BEGIN
  65.     (* $IF SmallData *)
  66.     OberonLib.SetA5();
  67.     (* $END *)
  68.     IF debug THEN
  69.       RETURN KGetNum();
  70.     END;
  71.     RETURN -1;
  72.   END GetNumA;
  73.  
  74. PROCEDURE MayGetCharA*():CHAR;
  75.   BEGIN
  76.     (* $IF SmallData *)
  77.     OberonLib.SetA5();
  78.     (* $END *)
  79.     IF debug THEN
  80.       RETURN KMayGetChar();
  81.     END;
  82.     RETURN 0X;
  83.   END MayGetCharA;
  84.  
  85. PROCEDURE PrintFA*(string{8}: Exec.LSTRPTR; values{9} : SYSTEM.ADDRESS );
  86.   BEGIN
  87.     (* $IF SmallData *)
  88.     OberonLib.SetA5();
  89.     (* $END *)
  90.     IF debug THEN
  91.       KPrintF(string, values );
  92.     END;
  93.   END PrintFA;
  94.  
  95. PROCEDURE PutCharA*(char{0}: CHAR );
  96.   BEGIN
  97.     (* $IF SmallData *)
  98.     OberonLib.SetA5();
  99.     (* $END *)
  100.     IF debug THEN
  101.       KPutChar( char );
  102.     END;
  103.   END PutCharA;
  104.  
  105. PROCEDURE PutStrA*(string{8}: Exec.LSTRPTR);
  106.   BEGIN
  107.     (* $IF SmallData *)
  108.     OberonLib.SetA5();
  109.     (* $END *)
  110.     IF debug THEN
  111.       KPutStr( string );
  112.     END;
  113.   END PutStrA;
  114.  
  115. (* For documentation of these procedures see AutoDoc "DebugLib.doc" *)
  116.  
  117. PROCEDURE CmpStr*{"DebugLib.CmpStrA"}( string1{8}, string2{9}: ARRAY OF CHAR );
  118. PROCEDURE GetChar*{"DebugLib.GetCharA"}():CHAR;
  119. PROCEDURE GetNum*{"DebugLib.GetNumA"}():LONGINT;
  120. PROCEDURE MayGetChar*{"DebugLib.MayGetCharA"}():CHAR;
  121. PROCEDURE PrintF*{"DebugLib.PrintFA"}(string{8}: ARRAY OF CHAR; values{9}.. : SYSTEM.ADDRESS );
  122. PROCEDURE PutChar*{"DebugLib.PutCharA"}(char{0}: CHAR );
  123. PROCEDURE PutStr*{"DebugLib.PutStringA"}(string{8}: ARRAY OF CHAR);
  124.  
  125.  
  126.   PROCEDURE CheckForOutput*( name : ARRAY OF CHAR );
  127.   (*------------------------------------------
  128.     :Input.     name = name of env-variable to check
  129.     :Input.            for exists.
  130.     :Semantic.  Checks if an env-variable exists and then
  131.     :Semantic.  sets the output on or off.
  132.     :Update.    17-Sep-1994 [awn] - erstellt.
  133.   --------------------------------------------*)
  134.     VAR buffer : ARRAY 8 OF CHAR;
  135.     BEGIN
  136.       (* $IF SmallData *)
  137.       OberonLib.SetA5();
  138.       (* $END *)
  139.       debug := Dos.GetVar( name, buffer, SIZE( buffer ), LONGSET{}) # -1;
  140.     END CheckForOutput;
  141.  
  142.   PROCEDURE SetOutput*( value : BOOLEAN );
  143.   (*------------------------------------------
  144.     :Input.     value = TRUE or FALSE
  145.     :Semantic.  Sets the debug output on or off
  146.     :Update.    17-Sep-1994 [awn] - erstellt.
  147.   --------------------------------------------*)
  148.     BEGIN
  149.       debug := value;
  150.     END SetOutput;
  151.  
  152. END DebugLib.
  153.  
  154.